#!/usr/bin/python
import os, sys, string, commands

class XXDisk:
	def __init__(self):
		pass
		
	def run(self):
		print '############################################################'
		print self.checkPath('/home/fkong/')
		print self.checkPath('/home/fkong/dev_pcc/')
		print self.checkPath('/home/fkong/dev_scratch/')
		print '############################################################'
		
	def checkPath(self, path):
		cmd = 'sudo du -sh ' + path
		result = self.executeCmd(cmd)
		
		# remove "Permission denied" line
		list = string.split(result[len(result) - 1],'\n')
		size = list[len(list) - 1]
		
		# If the size includes the path info, remove it
		if(string.rfind(size, path) >= 0):
			size = string.replace(size, path, '')
		ret = 'The used size of ' + path + ' is : ' + size
		return ret
		
	def executeCmd(self, cmd):
		result = commands.getstatusoutput(cmd)
		return result

t = XXDisk()
t.run()
